project(sort)

cmake_minimum_required(VERSION 2.4)

include(FindPkgConfig)

if (CMAKE_BUILD_TYPE STREQUAL "Release")
  set(CMAKE_CXX_FLAGS "-O4 -march=native")
endif()

pkg_check_modules(PLPLOT plplotd-c++ REQUIRED)

include_directories(${PLPLOT_INCLUDE_DIRS})

add_definitions("-std=c++0x")

add_executable(ops_tests ops_tests.cpp)

add_executable(gen_rand_int gen_rand_int.cpp)

add_executable(plot plot_example.cpp)
target_link_libraries(plot ${PLPLOT_LIBRARIES})

add_executable(sort-int sort-int.cpp)
target_link_libraries(sort-int ${PLPLOT_LIBRARIES})

add_executable(sort-string sort-string.cpp)
target_link_libraries(sort-string ${PLPLOT_LIBRARIES})

if (DEFINED JEMALLOC AND JEMALLOC EQUAL 1)
  target_link_libraries(sort-int -ljemalloc)
  target_link_libraries(sort-string -ljemalloc)
endif()

add_executable(tests tests.cpp)
